package com.api.syh56.shengyunhui.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.gitee.sunchenbin.mybatis.actable.annotation.*;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant;
import lombok.AccessLevel;
import lombok.Data;
import lombok.experimental.FieldDefaults;

import javax.persistence.Id;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.UUID;

/**
 * 专线开单
 */

@Data
@FieldDefaults(level = AccessLevel.PRIVATE)
@TableName("bill")
public class Bill {
    @Column(name = "id",isKey = true,isAutoIncrement = true,comment = "id")
    Long id;

    @Column(name = "waybill_id") //运单号，专线可以跟运单绑定，但不是必须绑定
    Long WayBillId;

    @Column(name = "network_org") // 始发网点
    String NetworkOrg;

    @Column(name = "network_dest") // 目的网点
    String NetworkDest;

    @Column(name = "network_org_location") // 始发网点经纬度
    String NetworkOrgLocation;

    @Column(name = "network_dest_location") // 目的网点经纬度
    String NetworkDestLocation;

    @Column(name = "goods_package_method") // 包装方式
    String GoodsPackageMethod;

    @Column(name = "closed")
    Boolean Closed;

    @Column(name = "invoiced")
    Boolean Invoiced;

    @Column(name = "invalid")
    Boolean Invalid;

    @Column(name = "fee_trans")
    BigDecimal FeeTrans;

    @Column(name = "fee_receive") // 接货费
    BigDecimal FeeReceive;

    @Column(name = "fee_delivery") // 送货费
    BigDecimal FeeDelivery;

    @Column(name = "fee_info") // 信息费
    BigDecimal FeeInfo;

    @Column(name = "fee_total") // 总费用
    BigDecimal FeeTotal;

    public BigDecimal getFee_total() {
        FeeTotal = BigDecimal.ZERO
                .add(FeeReceive == null ? BigDecimal.ZERO : FeeReceive)
                .add(FeeDelivery == null ? BigDecimal.ZERO : FeeDelivery)
                .add(FeeInfo == null ? BigDecimal.ZERO : FeeInfo)
                .add(FeeTrans == null ? BigDecimal.ZERO : FeeTrans);
        return FeeTotal;
    }


    @Column(name = "pay_method") // 结算方式
    Integer PayMethod;

    @Column(name = "receive_contact") // 收货联系人
    String ReceiveContact;

    @Column(name = "receive_telephone") // 收货人联系电话
    String ReceiveTelephone;

    @Column(name = "receive_address") // 收货人联系地址
    String ReceiveAddress;

    @TableField(fill = FieldFill.INSERT)
    @Column(name = "creator_user_id") // 创建人用户ID
    Long creatorUserId;

    @TableField(fill = FieldFill.INSERT)
    @Column(name = "creation_time") // 创建时间
    LocalDateTime creationTime;

    @Column(name = "tenant_id") // 租户ID
    Integer TenantId;

    @Column(name = "last_modifier_user_id") // 最后修改人用户ID
    Long LastModifierUserId;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    @Column(name = "last_modification_time") // 最后修改时间
    LocalDateTime lastModificationTime;

    @TableLogic
    @Column(name = "is_deleted")
    @DefaultValue("false")
    private Boolean isDeleted;
}
